package com.shf.entity;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.io.Serializable;

import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.Alias;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * (Product)实体类
 *
 * @author makejava
 * @since 2023-10-11 11:28:31
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Alias("Product")
public class Product implements Serializable{


    private String id;

    private String productNum;

    private String productName;

    private String cityName;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date departureTime;

    private Integer productPrice;

    private String productDesc;
    /** 产品状态码*/
    private Integer productStatus;
    /**显示产品状态*/
    private String productStatusStr;
    /**显示时间文本*/
    private String departureTimeStr;


    public String getDepartureTimeStr() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        departureTimeStr = dateFormat.format(departureTime);
        return departureTimeStr;
    }


    public String getProductStatusStr() {

        if (productStatus == null){
            return "";
        }

        if (productStatus == 0){
            productStatusStr = "关闭";
        }
        if (productStatus == 1){
            productStatusStr="开启";
        }
        return productStatusStr;
    }
}

